1
'************************************* Module Header **************************************\
2 ' Module Name: UC_CumstomPropertyTab.vb
3 ' Project: VBWinFormDesigner
4 ' Copyright (c) Microsoft Corporation.
7 ' The CustomPropertyTab sample demonstrates how to add custom PropertyTab on to the
11 ' This source is subject to the Microsoft Public License.
12 ' See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
13 ' All other rights reserved.
15 ' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
16 ' EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
17 ' WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
18 '***************************************************************************'
20 Imports System
.ComponentModel
21 Imports System
.Windows
.Forms
.PropertyGridInternal
23 Namespace CustomPropertyTab
25 <PropertyTab(GetType(CustomTab
), PropertyTabScope
.Component
)> _
26 Partial
Public Class UC_CustomPropertyTab
30 Me.InitializeComponent()
33 <CustomTabDisplayAttribute(True), Browsable(False)> _
34 Public Property TestProp() As String
38 Set(ByVal value
As String)
43 'Private components As IContainer = Nothing
44 Private _testProp
As String
48 Public Class CustomTab
49 Inherits PropertiesTab
51 Public Overrides
Function CanExtend(ByVal extendee
As Object) As Boolean
52 Dim test
As Boolean = TypeOf extendee Is UC_CustomPropertyTab
53 MessageBox
.Show(test
.ToString())
54 Return TypeOf extendee Is UC_CustomPropertyTab
57 Public Overrides
Function GetProperties(ByVal context
As ITypeDescriptorContext
, ByVal component
As Object, ByVal attrs
As Attribute()) As PropertyDescriptorCollection
58 Return TypeDescriptor
.GetProperties(component
, New Attribute() {New BrowsableAttribute(False), New CustomTabDisplayAttribute(True)})
61 Public Overrides ReadOnly
Property TabName() As String
69 <AttributeUsage(AttributeTargets
.Property)> _
70 Public Class CustomTabDisplayAttribute
73 Public Sub New(ByVal display
As Boolean)
77 Public Property Display() As Boolean
81 Set(ByVal value
As Boolean)
86 Private _display
As Boolean